//
//  StyTableViewCell.m
//  HomeFurnishing
//
//  Created by dllo on 16/3/28.
//  Copyright © 2016年 YMing. All rights reserved.
//

#import "StyTableViewCell.h"

@implementation StyTableViewCell

-(void)dealloc
{
    [_imgView release];
    [_title release];
    [_details release];
    [_style release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imgView = [[UIImageView alloc] init];
        //_imgView.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_imgView];
        [_imgView release];
        
        self.title = [[UILabel alloc] init];
        _title.font = [UIFont systemFontOfSize:20];
        //_title.backgroundColor = [UIColor yellowColor];
        _title.lineBreakMode = NSLineBreakByTruncatingMiddle;
        [self.contentView addSubview:_title];
        [_title release];
        
        self.details = [[UILabel alloc] init];
        _details.numberOfLines = 0;
        //_details.backgroundColor = [UIColor orangeColor];
        //_details.lineBreakMode = NSLineBreakByTruncatingMiddle;
        [self.contentView addSubview:_details];
        [_details release];
        
        self.style = [[UILabel alloc] init];
        _style.textColor = [UIColor blueColor];
        //_style.backgroundColor = [UIColor greenColor];
        [self.contentView addSubview:_style];
        [_style release];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    _imgView.frame = CGRectMake(5, 5, 140, self.contentView.frame.size.height -20);
    _title.frame = CGRectMake(self.imgView.frame.size.width +15, 10, 190, 40);
    _details.frame = CGRectMake(self.imgView.frame.size.width +15, _title.frame.origin.y + _title.frame.size.height, 190, 50);
    _style.frame = CGRectMake(self.imgView.frame.size.width +15, _details.frame.origin.y + _details.frame.size.height+20, 100, 30);
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
